const prodConfig = require('./webpack.prod')
module.exports = {
    ...prodConfig,
    mode: 'development',
    devtool: 'cheap-module-source-map',
    devServer: {
        historyApiFallback: true,
        host: 'localhost',
        port: 3000,
        open: true,
        hot: true,
        // 代理服务器配置
        // 当你请求的路径以/api 开头的时候，代理服务器就会转发请求
        // localhost:3000/api/addAdmin   ==>  localhost:7000/api/addAdmin ==>localhost:7000/addAdmin
        proxy: {
            '/api': {
                target: 'http://localhost:7000',
                // 重写路径 将 /api ==> '' 
                pathRewrite: { '^/api': '' },
            },
        },
    }
}